<?php

/*
	[SupeSite] (C) 2007-2009 Comsenz Inc.
	$Id: admin_spacenews.php 13513 2009-11-26 07:34:15Z zhaofei $
*/
@include_once(S_ROOT.'./function/register.func.php');
if(!defined('IN_SUPESITE')) {
	exit('Access Denied');
}

if(empty($_SGLOBAL['supe_uid'])) {
	showmessage('no_login', geturl('action/login'));
}


if (submitcheck('pdsubmit')) {

	if($_POST['newpasswd1'] != $_POST['newpasswd2']) {
		showmessage('password_inconsistency');
	}
	if($_POST['newpasswd1'] != addslashes($_POST['newpasswd1'])) {
		showmessage('profile_passwd_illegal');
	}
	//$ucresult = uc_user_edit($_SGLOBAL['supe_username'], $_POST['password'], $_POST['newpasswd1']);
	$uresult = edit_user($_SGLOBAL['supe_username'],$_POST['password'], $_POST['newpasswd1'],$_SGLOBAL['user']['phonenum']);

    if($uresult == trim('success')){
        sclearcookie();
        showmessage('getpasswd_succeed', '/login'   );
    }else if($uresult == -1) {
		showmessage('old_password_invalid');
	}elseif($uresult == -7) {
		showmessage('no_change');
	} elseif($uresult == -8) {
		showmessage('protection_of_users');
	}elseif($uresult == 0){
        showmessage('no_change');
    }else{
        showmessage('修改失败！');
    }



}

include template('cp_useredit');

?>
